//
//  MovieListCell.m
//  UI豆瓣2
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieListCell.h"
#import "Movie.h"
#import "UIImageView+WebCache.h"
@implementation MovieListCell

- (void)dealloc
{
    [_movieName release];
    [_headImage release];
    [_bgImage release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMovieList];
    }
    return self;
}

- (void)createMovieList{
    self.bgImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_eventlistcell.png"]];
    self.bgImage.frame = CGRectMake(20, 10, 335, 150);
    [self.contentView addSubview:self.bgImage];
    [_bgImage release];
    
    self.headImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"picholder.png"]];
    self.headImage.frame = CGRectMake(15, 10, 90, 130);
    [self.bgImage addSubview:self.headImage];
    [_headImage release];
    
    self.movieName = [[UILabel alloc] initWithFrame:CGRectMake(120, 40, 200, 80)];
    self.movieName.font = [UIFont systemFontOfSize:20];
    [self.bgImage addSubview:self.movieName];
    self.movieName.text = @"致我们终将逝去的青春123";
    self.movieName.numberOfLines = 0;
    [_movieName release];
}

- (void)setMovie:(Movie *)movie{
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    self.movieName.text = self.movie.movieName;
    
    NSURL *url = [NSURL URLWithString:self.movie.pic_url];
    [self.headImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    
}

@end
